import { lightColors, darkColors, lightStyle, darkStyle } from './theme';
import { theme } from 'antd';
// 根据 isDark 判断获取哪种主题样式
export const getThemeConfig = (isDark) => {
    const colors = isDark ? darkColors : lightColors;
    const styles = isDark ? darkStyle : lightStyle;
    return {
        token: { // 全局 Design Token 配置
            colorPrimary: colors['primary'],
            colorBgBase: colors['background'],
            colorTextBase: colors['text'],
            colorInfo: colors['primary'],
            colorSuccess: colors['success'],
            colorWarning: colors['warning'],
            colorError: colors['danger'],
            colorBorder: colors['divider'],
        },
        cssVar: {
            key: 'r-theme',
        },
        hashed: false, // 根据官方文档，如果应用中只存在一个版本的 antd，可以选择关闭 hash 来进一步减小样式体积
        algorithm: theme.defaultAlgorithm,
        components: { // 组件 token 配置
            Button: {
                colorPrimaryHover: colors['accent'],
                primaryShadow: styles['primaryShadow'],
                dangerShadow: styles['dangerShadow'],
            },
            Menu: {
                itemActiveBg: styles['itemActiveBg'],
                itemSelectedBg: colors['selectedBg'],
            },
            Layout: {
                headerBg: colors['card'],
            },
        },
    };
}